package lhc.alg.top100;

/**
 * description:  https://leetcode.cn/problems/valid-palindrome/
 *  api解法 
 * author: hongchen.liao
 * date:  2022/8/9
 */
public class _125_Valid_Palindrome {

    class Solution {
        public boolean isPalindrome(String s) {
            StringBuilder sb = new StringBuilder();
            for(char ch : s.toCharArray()){
                if(Character.isLetterOrDigit(ch)){
                    sb.append(Character.toLowerCase(ch));
                }
            }
            StringBuilder sb_res = new StringBuilder(sb).reverse();
            return sb.toString().equals(sb_res.toString());
        }
    }

}
